﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="consumlist.aspx.cs" Inherits="LabMS.Web.Equipment.Consum.consumlist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>易耗品一览表</title>
    <link type="text/css" rel="stylesheet" href="../../style/screen.css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../../style/ie7.css" />
    <![endif]-->

    <script type="text/javascript" src="../../js/Calendar5.js"></script>

    <script type="text/javascript">
    var c = new Calendar("c");
    document.write(c);
    </script>

</head>
<body class="mainBody">
    <form id="form1" defaultbutton="btSearch" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        易耗品一览表</label>
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <%--<asp:CheckBox ID="checkall" runat="server" Font-Size="9pt" Text="全选" />--%>
                <% if (UserType == "mana")
                  {%>
                <input id="btAddConsum" type="button" onclick="RedirectURL(window, 'addconsum.aspx');"
                    value="入库" class="button" />
                <%} %>
                <asp:Button ID="btDel" runat="server" Text="删除" OnClick="btDel_Click" CssClass="button" />
            </p>
            <p>
                <label>
                    查询列</label>
                <asp:DropDownList ID="ddlCClass" runat="server" Height="20px" Width="100px">
                    <asp:ListItem Value="Name">耗材名称</asp:ListItem>
                    <asp:ListItem Value="Numbers">耗材编号</asp:ListItem>
                </asp:DropDownList>
                <label>
                    关键字</label>
                <asp:TextBox ID="tbKeyWords" runat="server"></asp:TextBox>
                <label>
                    入库时间</label>
                <asp:TextBox ID="tbCreateDateMin" runat="server"></asp:TextBox>
                --
                <asp:TextBox ID="tbCreateDateMax" runat="server"></asp:TextBox>
                <label>
                    用途</label>
                <asp:TextBox ID="tbPurpose" runat="server"></asp:TextBox>
                <asp:Button ID="btSearch" runat="server" Text="搜索" OnClick="btSearch_Click" CssClass="button" />
                <asp:Button ID="btUpdate" CssClass="button" runat="server" Text="刷新" OnClick="btUpdate_Click" />
            </p>
        </div>
        <div class="main">
            <asp:GridView ID="GridViewConsum" runat="server" Width="100%" PageSize="15" AllowPaging="true"
                DataKeyNames="ID" AutoGenerateColumns="False" OnRowDataBound="GridViewConsum_RowDataBound"
                OnPageIndexChanging="GridViewConsum_PageIndexChanging" CssClass="infoTable" OnRowCreated="GridViewConsum_RowCreated">
                <Columns>
                    <asp:TemplateField ItemStyle-CssClass="checkBox">
                        <HeaderTemplate>
                            <asp:CheckBox ID="CBAll" runat="server" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="checkdel" /></ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="CreatedDate" HeaderText="入库时间" DataFormatString="{0:yyyy/MM/dd}"
                        HtmlEncode="false" />
                    <asp:BoundField DataField="Numbers" HeaderText="耗材编号" />
                    <asp:BoundField DataField="Name" HeaderText="耗材名称" />
                    <asp:BoundField DataField="CName" HeaderText="耗材分类" />
                    <asp:BoundField DataField="Model" HeaderText="耗材型号" />
                    <asp:BoundField DataField="Documents" HeaderText="单据号" />
                    <asp:BoundField DataField="LabName" HeaderText="库存位置" />
                    <asp:BoundField DataField="Quantity" HeaderText="数量" />
                    <asp:BoundField DataField="UnitPrice" HeaderText="单价" />
                    <asp:BoundField DataField="TotalPrice" HeaderText="总价" />
                </Columns>
                <HeaderStyle CssClass="header" />
                <RowStyle HorizontalAlign="Center" />
                <EmptyDataTemplate>
                    <a style="color: Red">无数据</a>
                </EmptyDataTemplate>
            </asp:GridView>
            <asp:Label ID="lbErr" runat="server" ForeColor="Red" Text="Err" Visible="False"></asp:Label>
        </div>
    </form>

    <script type="text/javascript" src="../../js/Common.js"></script>

    <script type="text/javascript" src="../../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript" src="../../js/site.js"></script>

    <script type="text/javascript">

        $(function(){
            /* 修改样式 */
            $("#GridViewConsum > tbody > tr:even").not(":first").addClass("even");
            $("#GridViewConsum > tbody > tr").not(":first")
                .hover(
                    function(){
                        $(this).addClass("hover");
                    },
                    function(){
                        $(this).removeClass("hover");
                });

            /* 全选 */
            $("#GridViewConsum > tbody > tr:first :checkbox").click(function(){
                if ($(this).attr("checked")){
                    $("#GridViewConsum :checkbox").attr("checked", "checked");
                    cbChanged();
                } else{
                    $("#GridViewConsum :checkbox").attr("checked", "");
                    cbChanged();
                }
            });

            /* Checkbox事件 */
            $("#GridViewConsum :checkbox").not(":first").click(cbChanged);

            cbChanged();
        });

        /* 检测Checkbox的选择状态，更改button的disabled属性 */
        function cbChanged(){
            var hasChecked = false;
            var allChecked = true;
            $("#GridViewConsum :checkbox").not(":first").each(function(index, domEle){
                var curChecked = $(domEle).attr("checked");
                if (!hasChecked && curChecked){
                    hasChecked = true;
                }

                allChecked &= curChecked;
            });

            if (hasChecked){
                $("#btDel").attr("disabled", "");
            } else {
                $("#btDel").attr("disabled", "disabled");
            }

            if (allChecked){
                $("#GridViewConsum :checkbox").filter(":first").attr("checked", "checked");
            } else {
                $("#GridViewConsum :checkbox").filter(":first").attr("checked", "");
            }
        }
    </script>

</body>
</html>
